package businessLogic;

import businessEntities.exceptions.ConnectionException;
import dataAccess.DALConnectionManager;

public class BLConnetionManager {

    public BLConnetionManager() {
        /*Empty*/

    }

    /**
     * Initialize connection to data base according to the credentials that was passed to the method.
     * @return true if and only if the connection was successfully initialized.
     */
    public boolean initializeConnection(String hostName, String userName, String password, String port) {
        try {
            DALConnectionManager connectionInit = new DALConnectionManager();
            connectionInit.connectDB(hostName, userName, password, port);
        } catch (ConnectionException ex) {
            return false;
        }
        return true;
    }

    public static void closeConnection() {
        DALConnectionManager.closeConnection();
    }
}
